$(function(){
	/***********ios click 延迟*************/
    FastClick.attach(document.body);
    
	$(".hr .icon-menu").click(function(){
		$(".menuMainLayer").fadeIn()
	});
	$(".menuMainLayer").click(function(){
		$(this).fadeOut()
	});
	$(".menuMainLayer a").click(function(e){
		e.stopPropagation();
	});
	$(document).on("click",".popUpClose",function(){
        hidePopup($(this));
	});


    
    /**************radio checkbox*********/
    $(".radioBtn input[type='radio']").click(function(){
        $(this).parents(".psList").find(".selected").removeClass("selected");
        $(this).parent(".radioBtn").addClass("selected");
    });
    $(".checkboxBtn input[type='checkbox']").click(function(){
        $(this).parent(".checkboxBtn").toggleClass("selected");
    });

    /**************侧边栏选择*********/
    $(".openSideSelector").click(function(){
        $(".sideSelector .sideContent").animate({"right":"0%"},300);
        $(".sideSelector").show();
        $(".main-wrapper").css("overflow","hidden")
    });
    $(".openSideSelector1").click(function(){
        $(".sideSelector1 .sideContent").animate({"right":"0%"},300);
        $(".sideSelector1").show();
        $(".main-wrapper").css("overflow","hidden")
    });
    $(".openSideSelector2").click(function(){
        $(".sideSelector2 .sideContent").animate({"right":"0%"},300);
        $(".sideSelector2").show();
        $(".main-wrapper").css("overflow","hidden")
    });

    $(".sideMask").click(function(){
        $(this).siblings(".sideContent").animate({"right":"-100%"},300,function(){
            $(this).parents(".sideSelector").hide();
            $(".main-wrapper").css("overflow-y","auto")
        })
    });
    $(".closeSide").click(function(){
        $(this).parents(".sideContent").animate({"right":"-100%"},300,function(){
            $(this).parents(".sideSelector").hide();
            $(".main-wrapper").css("overflow-y","auto")
        })
    });
    /************closeThis popUp*************/
    $(".popUpOuter .closeThis").click(function(){
        hidePopup($(this));
    });
});
function hidePopup(t){
    t.parents(".popUpMask").fadeOut();   
}
function showMsg(msg){
    var div = $("<div/>").appendTo($("body"));
    var p = $("<p/>").appendTo(div);

    div.css({"position":"fixed","z-index":"10000000","top":"45%","left":"0","right":"0","display":"none","color":"#fff","font-size":"16px","text-align":"center"})
    p.css({"display":"inline-block","padding":"15px","border-radius":"5px","background":"rgba(0,0,0,.6)"});
    p.html(msg);
    div.fadeIn();
    setTimeout(function(){
        div.fadeOut(300,function(){
          div.remove();
        });
    },2000);
}
function showMsgUrl(msg,url){
    var div = $("<div/>").appendTo($("body"));
    var p = $("<p/>").appendTo(div);

    div.css({"position":"fixed","z-index":"100000","top":"45%","left":"0","right":"0","display":"none","color":"#fff","font-size":"16px","text-align":"center"})
    p.css({"display":"inline-block","padding":"15px","border-radius":"5px","background":"rgba(0,0,0,.6)"});
    p.html(msg);
    div.fadeIn();
    setTimeout(function(){
        div.fadeOut(300,function(){
          div.remove();
        });
        window.location.href = url;
    },2000);
}
$.fn.extend({
    showPopup:function(){
        return this.each(function(){
            var t = $(this);
            t.fadeIn();
            
        });
    }
});
function vcenter(obj){
	obj.css("marginTop","-"+obj.height()/2+"px");
}
